import myAxios from './http';
// 管理员部分的api
function uploadImg(params) {
  return myAxios({
    url: '/upload',
    method: 'post',
    data: params,
    type: 'formData',
  });
}
//拉取所有注册信息
function getUserData(params) {
  return myAxios({
    url: '/student/',
    method: 'get',
    data: params,
  });
}
//通过注册申请
function updateStatus(params) {
  return myAxios({
    url: '/option/pass_active/',
    method: 'post',
    data: params,
  });
}
//删除用户账号
function deleteUser(id) {
    if(id!==0&&!id){return new Promise(function(res,req){})}
  return myAxios({ 
    url: `/user/leave/${id}`,
    method: 'delete',
    data:{} 
  });
}

//发布作业
function updateWork(params) {
  return myAxios({
    url: '/work_manager/',
    method: 'post',
    data: params,
    // type: 'formData',
  });
}
//获取搜索到的结果
function getSearchList(params) {
  return myAxios({
    url: 'user/fuzzy/student',
    method: 'post',
    data: params,
    // retryTimes: 3,
    // repeat_request_cancel: false,
  });
}
function findPage(params) {
  // params是pagesize和pagenum
  return myAxios('/message/findPage', { params });
}
function getAll(params) {
  return myAxios({
    url:'/student',
    method:'get',
    data:params,
  });
}
function fuzzyStudents(params){
    return myAxios({
    url:'user/fuzzy/student',
    method:'post',
    data:params,
  });
}

function download(params) {
  return myAxios({
    url:'/download',
    method:'post',
    data:params,
  });
}
export default {
  // 在这里导出所有函数
  updateStatus,
  getUserData,
  getSearchList,
  findPage,
  updateWork,
  deleteUser,
    getAll,
fuzzyStudents,
download
};
